#include <stdlib.h>
#include <stdio.h>
#include <iostream>

using namespace std;

class top
{
public:
	int top;
};


class left:public top
{
public:
	int left;
};


class right:public top
{
public:
	int right;
};


class bottom:public left, public right
{
public:
	int bottom;
};


int main(int argc, char**argv)
{
	cout << sizeof(class top) << '\t' << sizeof(class left) << '\t' << sizeof(class right) << '\t' << sizeof(class bottom) << endl;
 	
	class left* pleft = new class left();
	cout << "class left: \t top: " << &pleft->top << "\tleft: " << &pleft->left << endl;

	class right* pright = new class right();
	cout << "class right: \t top: " << &pright->top << "\tleft: " << &pright->right << endl;

	bottom* pbottom = new bottom();
	cout << "class bottom: \t left top: " << &pbottom->left::top << "\tleft: " << &pbottom->left << "\tright top: " << &pbottom->right::top << "\tright: " << &pbottom->right << "\tbottom: " << &pbottom->bottom << endl;
	
	return 0;
}
